home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1589 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. Path: library.erc.clarkson.edu!rpi!not-for-mail
  2. From: thp@cs.ucr.edu (Tom Payne)
  3. Newsgroups: comp.lang.c++.moderated,comp.lang.c++
  4. Subject: Re: Meaning of the specifier volatile?
  5. Date: 11 Jan 1996 18:42:58 -0000
  6. Organization: University of California, Riverside Department of Computer Science
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: Dietmar.Kuehl@uni-konstanz.de
  9. Message-ID: <4d3lni$rug@netlab.cs.rpi.edu>
  10. References: <4c9740$27n@netlab.cs.rpi.edu> <4cff74$gfj@netlab.cs.rpi.edu> <4cj5u4$qjm@netlab.cs.rpi.edu>
  11. NNTP-Posting-Host: netlab.cs.rpi.edu
  12.  
  13. X-Original-Date: 6 Jan 1996 21:57:16 GMT
  14. [moderator's note:  This posting was apparently lost or delayed somewhere in the
  15. 'net, and we am re-posting it.  Please bear with us if this is a duplicate.]
  16. J. Kanze (kanze@gabi-soft.fr) wrote:
  17. [stuff deleted]
  18. : On point concerning volatile that I have not seen made is the fact that
  19. : the C/C++ concept of volatile is orthogonal to atomicity of access.
  20. : Declaring an object volatile is *NOT* sufficient with regards to
  21. : asynchronous events; the object must still be of a type for which the
  22. : compiler will generate atomic accesses.  
  23. [stuff deleted]
  24.  
  25. Because of the signal-handlers-can't-read provision of the ANSI C
  26. standard, atomicity is unnecessary in the coordination of asynchronous
  27. activity for programs with defined behavior:
  28.  
  29.   *  signal handlers won't read any partially written non-atomic 
  30.      shared variables, because they are not allowed to read variables 
  31.      of static storage class in programs with defined behavior.
  32.  
  33.   *  the program itself won't read any partially written non-atomic 
  34.      shared varible, because signal handlers don't return control 
  35.      until they have completed their writes of volatile variables.
  36.  
  37. With pre-emptive multithreading, of course, the possibility of
  38. pre-emption during a non-atomic write requires atomicity of some
  39. coordination variables, but it's impossible to introduce
  40. multithreading and stay within defined behavior per the ANSI 
  41. standard.
  42.  
  43. Tom Payne (thp@cs.ucr.edu)
  44.  
  45.     [ comp.lang.c++.moderated is a moderated newsgroup.  Submit articles ]
  46.     [  to <c++-submit@netlab.cs.rpi.edu>.  The moderation policy can be  ]
  47.     [   retrieved from <http://netlab.cs.rpi.edu/~cppmods/guide.html>.   ]
  48.     [    Moderators can be reached at: c++-request@netlab.cs.rpi.edu.    ]
  49.